﻿namespace Infrastructure.WebApi
{
    #region 基础请求
    /// <summary>
    /// RequestBase
    /// </summary>
    public interface IRequestBase
    {

    }
    #endregion

    #region 根据主键来索引单条数据
    /// <summary>
    /// 根据主键来索引单条数据
    /// </summary>
    public class IdRequest : IRequestBase
    {
        public int Id { get; set; }
    }
    #endregion

    #region 分页
    /// <summary>
    /// 分页请求
    /// </summary>
    public class PageRequest : IRequestBase
    {
        private int _pageSize { get; set; } = 50;
        private int _pageIndex { get; set; } = 1;
        /// <summary>
        /// 默认1
        /// </summary>
        public int PageIndex
        {
            get { return _pageIndex; }
            set { _pageIndex = value < 0 ? 1 : value; }
        }
        /// <summary>
        /// 默认50，-1全部
        /// </summary>
        public int PageSize
        {
            get { return _pageSize; }
            set { _pageSize = value < 0 ? int.MaxValue : value; }
        }
    }
    #endregion

    public class KeywordRequest : PageRequest
    {
        public string Keyword { get; set; }
    }

}
